package com.phkj.qdh.ui.adapter.usercenter

import android.content.Context
import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.LinearLayout
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.phkj.qdh.R
import com.phkj.qdh.bean.MyTeamDetail
import com.phkj.qdh.bean.ZheDiThing
import com.phkj.qdh.utils.gone
import com.phkj.qdh.utils.visible

class MyFailoverThingsShowAdapter : BaseQuickAdapter<MyTeamDetail, QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: MyTeamDetail?) {
        holder.setText(R.id.tv_type1, "巡查类型：")
        holder.setText(R.id.tv_type_name1, item!!.firstTypeName)
        holder.setText(R.id.tv_type2, "问题类型：")
        holder.setText(R.id.tv_type_name2, item.secondTypeName)
        holder.setText(R.id.tv_type3, "处置办法：")
        holder.setText(R.id.tv_type_name3, item!!.disposalName)
        holder.setText(R.id.tv_date, item.rectificationPeriod ?: "")
        holder.setText(R.id.tv_fen, "预扣分额：")
        holder.setText(R.id.tv_fen_name, item.score.toString())
        holder.getView<LinearLayout>(R.id.ll_problem).visible()
        val ivState = holder.getView<ImageView>(R.id.iv)
        when (item.eventStatus) {
            0 -> {
                ivState.setImageResource(R.mipmap.icon_yitongguo)
            }
            else -> {
                ivState.setImageResource(R.mipmap.icon_weitongguo)
            }
        }
    }

    override fun onCreateViewHolder(
        context: Context, parent: ViewGroup, viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_my_failover_things, parent)
    }
}